package jgl.vajra.kingkong.part.home.viewModel;

import java.util.List;
import java.util.Map;

import jgl.vajra.kingkong.bean.CityChoiceBean;
import jgl.vajra.kingkong.bean.OpenCityBean;
import jgl.vajra.kingkong.part.home.contract.CityChoiceContract;
import jgl.vajra.kingkong.part.home.model.CityChoiceModel;
import jgl.vajra.kingkong.widget.mvvm.factory.CreateModel;
import jgl.vajra.kingkong.widget.retrofithelper.rxsubscriber.ProgressObserver;

@CreateModel(CityChoiceModel.class)
public class CityChoiceViewModel extends CityChoiceContract.ViewModel{
    @Override
    public void getAreaInfoData(Map<String, Object> map) {
        mModel.getAreaInfoData(map).subscribe(new ProgressObserver<List<CityChoiceBean>>(false,null) {
            @Override
            public void _onNext(List<CityChoiceBean> cityChoiceBean) {
                mView.returnAreaInfoBean(cityChoiceBean);
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
            }
        });
    }

    @Override
    public void getOpenCityData(Map<String, Object> map) {
        mModel.getOpenCityData(map).subscribe(new ProgressObserver<OpenCityBean>(false,this) {
            @Override
            public void _onNext(OpenCityBean openCityBean) {
                mView.returnOpenCityData(openCityBean);
            }
        });
    }
}
